-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Log Type JSON format #465
New Log Type JSON format #465
Conversation
Signed-off-by: Petar Dzepina <[email protected]>
Signed-off-by: Petar Dzepina <[email protected]>
Signed-off-by: Petar Dzepina <[email protected]>
Signed-off-by: Petar Dzepina <[email protected]>
Signed-off-by: Petar Dzepina <[email protected]>
Signed-off-by: Subhobrata Dey <[email protected]>
Signed-off-by: Petar Dzepina <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #465 +/- ##
============================================
+ Coverage 28.21% 28.23% +0.02%
- Complexity 897 906 +9
============================================
Files 231 235 +4
Lines 9326 9443 +117
Branches 1074 1081 +7
============================================
+ Hits 2631 2666 +35
- Misses 6459 6545 +86
+ Partials 236 232 -4
|
Signed-off-by: Subhobrata Dey <[email protected]>
fix flaky tests
|
||
for(Mapping m : mappings) { | ||
out.writeString(m.getRawField()); | ||
out.writeString(m.getEcs()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use out.writeCollection
method here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
public class LogType implements Writeable, ToXContentObject { | ||
|
||
private static final String ID = "id"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add unit tests for this class similar to https://github.com/opensearch-project/common-utils/blob/main/src/test/kotlin/org/opensearch/commons/alerting/model/FindingTests.kt & https://github.com/opensearch-project/common-utils/blob/main/src/test/kotlin/org/opensearch/commons/alerting/model/WriteableTests.kt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
for(String category: ruleCategories){ | ||
queryBackendMap.put(category, new OSQueryBackend(category, true, true)); | ||
for(String category: ruleCategories) { | ||
Map<String, String> fieldMappings = logTypeService.getRuleFieldMappings(category); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getRuleFieldMappings
internally calls getAllLogTypes
from BuiltinLogTypeLoader
which internally calls loadBuiltinLogTypes
.
Why do we need to load all log types & then filter for particular category in memory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actual loading of logTypes from disk will be done only 1 time. I replaced getAllLogTypes
with BuiltinLogTypeLoader.getLogTypeByName(logType)
existing method.
Signed-off-by: Petar Dzepina <[email protected]>
Signed-off-by: Petar Dzepina <[email protected]>
Signed-off-by: Petar Dzepina <[email protected]>
Signed-off-by: Petar Dzepina <[email protected]>
Signed-off-by: Petar Dzepina <[email protected]>
* New Log Type JSON format Signed-off-by: Petar Dzepina <[email protected]> Co-authored-by: Subhobrata Dey <[email protected]> (cherry picked from commit faccf6c)
* New Log Type JSON format Signed-off-by: Petar Dzepina <[email protected]> Co-authored-by: Subhobrata Dey <[email protected]> (cherry picked from commit faccf6c)
Description
Issues Resolved
#459
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.